<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>我发布</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link rel="stylesheet" type="text/css" href="../../../css/mui.min.css" />
	<link rel="stylesheet" type="text/css" href="../../../css/mescroll.min.css" />
	<link rel="stylesheet" type="text/css" href="../../../css/pages/neighborList.css"/>
</head>

<body style="background: #F7F7F7;">
	<div id="mescroll" class="mescroll" style="padding-top: 15px;">
		<div  v-if="list.length > 0">
			<div class="activity p-b-15">
				<div class="list">
					<div class="item m-b-15" v-for="item in list" @click="itemTap(item.actID)">
						<div class="item-title">
							<span v-if="item.actStatus == 1"  style="color: #fcc747;">未开始</span>
							<span v-if="item.actStatus == 2"  style="color: #DD524D;">进行中</span>
							<span v-if="item.actStatus == 3"  style="color: #999;">已结束</span>
							<span>#</span>
							<span v-text="item.actTitle"></span>
						</div>
						<div class="item-image">
							<img class="item-br" :imgurl="item.filesPath" src="../../../images/jiazai.gif" />
						</div>
						<div class="item-desc">
							<div class="item-time">
								<img src="../../../images/timg.png">
								<span>{{item.actStartTime | dateFormat}} — {{item.actEndTime | dateFormat}}</span>
							</div>
						</div>
					</div>
				</div> 
			</div>
		</div>
	</div>
	<script src="../../../js/Width.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/mescroll.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/Util.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../data-js/home.js" type="text/javascript" charset="utf-8"></script>
	<script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
	<script type="text/javascript">
		mui.init()
		var mescroll;
		mui.plusReady(function () {
			if (!mui.os.android) {
				FastClick.attach(document.body);
			}

			mescroll = new MeScroll("mescroll", {
				down: {
					auto: false,
					callback: downCallback,
					outOffsetRate: 0.01
				},
				up: {
					callback: upCallback,
					page: {
						num: 0,
						size: 10
					},
					lazyLoad: {
						use: true,
						attr: 'imgurl',
						showClass: 'mescroll-lazy-in',
						delay: 500,
						offset: 200
					},
					noMoreSize: 3,
					empty: {
						warpId: "mescroll",
						icon: "../../../images/zanwu.png",
						tip: "您还没有发布活动呢~",
						btntext: "",
						btnClick: null,
						supportTap: false
					},
					htmlNodata: '<p class="upwarp-nodata">-- 没有更多数据了 --</p>',
					toTop: {
						warpId: "mescroll",
						src: "../../../images/neighbor/br.jpg",
						offset: 400
					},
// 					onScroll: function (mescroll, y, isUp) {
// 						console.log(y)
// 					}
				}
			})



		})

		var app = new Vue({
			el: "#mescroll",
			data: {
				list: []
			},
			filters: {
				dateFormat: function (value){
					var list = value.split(" ")
					var _list = list[0].split("-")
					return _list[1] + '月' + _list[2] + '日' + " " + list[1]
				}
			},
			methods: {
				itemTap: function (id) {
					mui.openWindow({
						url: 'details.html',
						id: 'details.html',
						styles: { // 窗口参数 参考5+规范中的WebviewStyle,也就是说WebviewStyle下的参数都可以在此设置
							titleNView: { // 窗口的标题栏控件
								titleText: "活动详情", // 标题栏文字,当不设置此属性时，默认加载当前页面的标题，并自动更新页面的标题         // 字体颜色,颜色值格式为"#RRGGBB",默认值为"#000000"
								titleSize: "17px", // 字体大小,默认17px
								backgroundColor: "#ffffff", // 控件背景颜色,颜色值格式为"#RRGGBB",默认值为"#F7F7F7"
								autoBackButton: true
							}
						},
						extras: {
							actID: id,
						},
					})
				}
			},
		})
		
		
		function downCallback() {
			mui.post(Util.HTTP + 'api/Activity/GetMyActivity', {
				neiID: Util.getState('hosing').neiID,
				userID: Util.getState('$state').userID,
				page: 1,
				number: 10
			}, function (res) {
				if(res.code==1001){
					mescroll.endSuccess();
					app.list = res.data
				}else{
					mui.toast(res.message)
				}
			})
		}

		function upCallback(page) {
			mui.post(Util.HTTP + 'api/Activity/GetMyActivity', {
				neiID: Util.getState('hosing').neiID,
				userID: Util.getState('$state').userID,
				page: page.num,
				number: page.size
			}, function (res) {
				if(res.code==1001){
					mescroll.endSuccess(res.data.length);
					app.list = app.list.concat(res.data)
				}else{
					mui.toast(res.message)
				}
			})
		}
	</script>
</body>

</html>
